package com.yfp.goods.service.impl;

import com.yfp.goods.domain.CPComboRoad;
import com.yfp.goods.mapper.CPComboRoadMapper;
import com.yfp.goods.service.CPComboRoadService;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;

import java.util.List;

/**
 * (CPComboRoad)表服务实现类
 *
 *
 * @since 2023-12-27 20:38:15
 */
@Service("cPComboRoadService")
public class CPComboRoadServiceImpl implements CPComboRoadService {
    @Resource
    private CPComboRoadMapper cPComboRoadMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public CPComboRoad queryById(String id) {
        return this.cPComboRoadMapper.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param cPComboRoad 筛选条件
     * @return 查询结果
     */
    @Override
    public List<CPComboRoad> queryByPage(CPComboRoad cPComboRoad) {
        return this.cPComboRoadMapper.queryAllByLimit(cPComboRoad);
    }

    /**
     * 新增数据
     *
     * @param cPComboRoad 实例对象
     * @return 实例对象
     */
    @Override
    public CPComboRoad insert(CPComboRoad cPComboRoad) {
        this.cPComboRoadMapper.insert(cPComboRoad);
        return cPComboRoad;
    }

    /**
     * 修改数据
     *
     * @param cPComboRoad 实例对象
     * @return 实例对象
     */
    @Override
    public CPComboRoad update(CPComboRoad cPComboRoad) {
        this.cPComboRoadMapper.update(cPComboRoad);
        return this.queryById(cPComboRoad.getId());
    }
}
